import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import store from './store/index'
import VueLazyload from "vue-lazyload";
import './common/stylus/index.styl'
import FastClick from 'fastclick'

//快速点击
FastClick.attach(document.body)

//图片懒加载
Vue.use(VueLazyload, {
    preLoad: 1.3,
    error:  require('./assets/logo.png'),
    loading: require('common/image/default.png'),
    attempt: 1
})


Vue.directive('dom', {
    bind(el, binding) {
       let config = { attributes: true, childList: true, subtree: true }
        let mutationCallback = () => {
            const f = binding.value
            f()
            observe.disconnect()
        }
        let observe = new MutationObserver(mutationCallback)
        observe.observe(el, config)
    }
})

new Vue({
    render: h => h(App),
    router,
    store
}).$mount('#app')
